<template>
  <view v-show="loading">
    <view class="bgm">
      <image :src="errorImageUrl" mode=" aspectFit"></image>
    </view>
    <view class="padding-sm rounds text-lg" style="padding-bottom: 100rpx">
      <view class="padding bg-white solid-bottom">
        <text class="text-bold">企业回收优势</text>
      </view>
      <view class="padding bg-white solid-bottom">
        <text class="text-bold">一对一的服务</text>
        <view class="text-sm">我们出色的专业服务团队，确保交易安全放心满意</view>
      </view>
      <view class="padding bg-white solid-bottom">
        <text class="text-bold">交易方式多样</text>
        <view class="text-sm">我们提供线上、线下、API接口，为您定制多种交易方式</view>
      </view>
      <view class="padding bg-white solid-bottom">
        <text class="text-bold">种类丰富，卡券齐全</text>
        <view class="text-sm">提供回收类型覆盖线上线下，等几十种礼品卡卡券</view>
      </view>
      <view class="padding bg-white solid-bottom">
        <text class="text-bold">极速资金回流</text>
        <view class="text-sm">我们在验卡成功后立即打款，资金回流速度超乎想象</view>
      </view>
    </view>
    <view class="anb flex flex-direction">
      <!-- <button class="cu-btn bg-blue margin-tb-sm lg" @tap="qq">咨询合作</button> -->
      <button class="cu-btn bg-blue margin-tb-sm lg" @tap="hezuo">咨询合作</button>
    </view>
    <v-popup @update:isShow="isShow = $event" :isShow="isShow"></v-popup>
    <!-- #ifdef MP-WEIXIN -->
    <v-kefu @tap="tokefu()"></v-kefu>
    <!-- #endif -->
    <!-- #ifndef MP-WEIXIN -->
    <view @click="tokefu()" class="">
      <v-kefu></v-kefu>
    </view>
    <!-- #endif -->
  </view>
</template>

<script>
import kefu from '@/components/kefu.vue';
import popup from '@/components/popup.vue';
export default {
  components: {
    'v-kefu': kefu,
    'v-popup': popup
  },
  data() {
    return {
      isShow: 0, //控制客服弹出层
      loading: false,
      qqh: null,
      mobile: '' //电话
    };
  },
  onLoad() {
    uni.showLoading({});
    this.getlogo();
  },
  computed: {
    errorImageUrl() {
      return this.app.httpUrl + '/static/uniapp/img/buss.png';
    }
  },
  methods: {
    tokefu() {
      this.isShow = !this.isShow;
    },
    // 点击咨询合作，打电话
    hezuo() {
      this.kefu(this.mobile);
    },
    // 拨打手机号
    kefu(mobile) {
      console.log(mobile);
      // #ifdef APP-PLUS
      uni.makePhoneCall({
        phoneNumber: mobile,
        success: function () {
          console.log('拨打电话成功！');
        },
        fail: function () {
          console.log('拨打电话失败！');
        }
      });
      // #endif
      // #ifdef MP-WEIXIN
      wx.makePhoneCall({
        phoneNumber: mobile,
        success: function () {
          console.log('拨打电话成功！');
        },
        fail: function () {
          console.log('拨打电话失败！');
        }
      });
      // #endif
    },
    qq() {
      // #ifdef APP
      plus.runtime.openURL('mqqwpa://im/chat?chat_type=wpa&uin=' + this.qqh + '&version=1&src_type=web&web_src=oicqzone.com');
      // #endif
      // #ifdef H5
      window.location.href = 'http://wpa.qq.com/msgrd?v=3&uin=' + this.qqh + '&site=qq&menu=yes';
      // #endif
    },
    getlogo() {
      var that = this;
      uni.request({
        url: that.app.apiHost + '/getlogo',
        method: 'POST',
        header: { Authorization: '' },
        success: (data) => {
          console.log(data.data);
          that.loading = true;
          uni.hideLoading();
          that.qqh = data.data.data.qq;
          this.mobile = data.data.data.business_mobile; //合作电话
        },
        fail() {
          that.app.showMsg('链接失败');
        }
      });
    }
  }
};
</script>

<style>
.bgm {
  width: 100%;
}
.bgm image {
  width: 100%;
}
.rounds {
  border-top-left-radius: 15px;
}
.anb {
  width: 100%;
  position: fixed;
  bottom: 0px;
  left: 0;
  padding: 0 10px;
}
</style>
